/*****************************************************************************************
* MERGING PERSON-SPECIFIC DATA WITH COMBINED INDIVDIUAL- AND HH-DATA		             *
*****************************************************************************************/

// change current file location
cd "SET_YOUR_PATH_FOR_OUTPUT/BHPS/combined"

// assign global macro to refer to BHPS & Understanding Society data
global ukhls "SET_YOUR_PATH_FOR_INPUT/UKDA-6614-stata/stata/stata11_se"

// load combined data
use all_indresp_hh.dta, clear

// merge person-specific data for BHPS respondents
merge m:1 pidp using "$ukhls/bhps_wx/xwaveid_bh.dta", keepus(sex birthy) gen(merge_bhps)

// merge person-specific data for UKHLS respondents
merge m:1 pidp using "$ukhls/ukhls_wx/xwavedat_v13.dta", keepus(sex birthy) gen(merge_ukhls) update replace

save all_indresp_hh_pers, replace

